# frozen_string_literal: true

ActiveAdmin.register TypeMethod do
  menu parent: ['Type System'], priority: 2

  permit_params do
    permitted = %i[name description]
    permitted
  end

  filter :variable_type
  filter :name
  filter :description

  index do
    selectable_column
    id_column
    column 'Name', :name
    column 'Parameters', :parameters
    column 'Description', :description

    actions defaults: false do |type|
      item 'View', admin_type_method_path(type)
    end
  end

  form do |f|
    f.inputs do
      f.input :name
      f.input :parameters
      f.input :description
    end
    f.actions
  end
end
